<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .switch {
            text-align: center;
            width: 200px;
            margin: 50px auto;
            padding: 10px;
            border: 1px solid #CCCCCC;
        }

        .switch input {
            display: none;
        }

        .switch label {
            width: 50px;
            height: 50px;
            display: inline-block;
            border-radius: 50%;
            box-shadow: 2px 3px 5px #999999, 0 0 1px #333333;
            position: relative;
            transition: .3s;
        }

        .switch label:hover {
            cursor: pointer;
        }

        .switch input:checked ~ label {
            box-shadow: 0 0 3px #333333;
        }

        .switch label:before {
            content: '';
            width: 25px;
            height: 25px;
            display: inline-block;
            border-radius: 50%;
            border: 4px solid #999999;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            transition: .4s;
        }

        .switch input:checked ~ label:before {
            border: 4px solid greenyellow;
        }

        .switch label:after {
            content: '';
            width: 4px;
            height: 15px;
            display: inline-block;
            border-radius: 2px;
            border-left: 5px solid white;
            border-right: 5px solid white;
            background-color: #999999;
            position: absolute;
            top: 5px;
            left: 50%;
            transform: translateX(-50%);
            transition: .4s;
        }

        .switch input:checked ~ label:after {
            background-color: greenyellow;
        }
    </style>
</head>
<body>
<div class="switch">
    <input type="checkbox" id="switch">
    <label for="switch"></label>
</div>
</body>
</html>